#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <set>
using namespace std;

/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     TreeNode *left;
 *     TreeNode *right;
 *     TreeNode(int x) : val(x), left(NULL), right(NULL) {}
 * };
 */

class Codec {
public:
    vector<string> ans;
    string buffer;
    void dfs(int x,string& s){
        int n = s.size();
        if(x==(n-1)){
            ans.push_back(buffer);
            buffer.clear();
        }
        set<char> x_char_buffer;
        for (int i = x; i < n; ++i) {
            auto ret = x_char_buffer.insert(s[i]);
            if(ret.second){
                swap(s[i],s[x]);
                dfs(x+1,s);
                swap(s[i],s[x]);
            } else{
                continue;
            }
        }
    }
    vector<string> permutation(string s) {
        dfs(0,s);
        return ans;

    }
};

int main(){
}